/*  This program is used for testing how the delare order of the member
 *  data in class take effective.
 *  note:
 *  The inintialize order is decided by the order of the declare, not the
 *  order in the init parameter list.
 *  g++ will complain a warning when the order of the declare is different
 *  from the order of the init parameter list. But this warning is sometime
 *  no use.
 */


#include <iostream>

using namespace std;

class A
{
public:
    A(int v):_value(v){ cout << "A_Constructor: " << _value << endl; }
    int getValue() { return _value; }
private:
    int _value;
};

class B
{
public:
    B(A& a):_value(a.getValue()+1){ cout << "B_constructor: " << _value << endl; }
private:
    int _value;
};

class C
{
public:
    C(int v): _valueB(_valueA),_valueA(v) { cout << "C_constructor" << endl; }
private:
    B _valueB;
    A _valueA;

};

int main()
{
    C c(10);
    return 0;
}
